-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Expose real time dispatch changes function #1532
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! Just a small remark on jsdoc
dc17427
to
6026040
Compare
When in a React environment, we use the RealTimeQueries component to subscribe to a doctype changes and keep the internal store updated. To be able to do the same thing manually for non React environment, we expose the underlaying functions : dispatchCreate, dispatchCreate, dispatchDelete.
6026040
to
fb807e0
Compare
If `CozyClient` is imported into those files, then unit tests fail. Using `@param {import('../CozyClient').default} client` syntax doesn't work either as this syntax is not handled by `jsdoc`. Jsdoc seems to support this syntax in later versions but then node engine should be updated. So client will be temporarily typed as `object` until a better solution is found.
@@ -1,6 +1,5 @@ | |||
import { Mutations } from '../queries/dsl' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really nitpicking, but why the plural in realtimes.js? There is only one, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... I should change it. It was because other file were plurals in the folder...
@@ -22,7 +21,7 @@ const normalizeDoc = (couchDBDoc, doctype) => { | |||
/** | |||
* DispatchChange | |||
* | |||
* @param {CozyClient} client CozyClient instane | |||
* @param {object} client CozyClient instane |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removing the CozyClient type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had issues with tests when moving the functions in the a file that is imported and exported in /store/index
. I found other commit fixing the same issue. Here is the explanation.
If `CozyClient` is imported into those files, then unit tests fail.
Using `@param {import('../CozyClient').default} client` syntax
doesn't work either as this syntax is not handled by `jsdoc`.
Jsdoc seems to support this syntax in later versions but then
node engine should be updated.
So client will be temporarily typed as `object` until a better solution
is found.
d77999a
to
981a4c2
Compare
When in a React environment, we use the RealTimeQueries component to subscribe to a doctype changes and keep the internal store updated.
To be able to do the same thing manually for non React environment, we expose the underlaying functions : dispatchCreate, dispatchCreate, dispatchDelete.